package com.xsomnus.mc.kafka.producer.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.springframework.kafka.support.ProducerListener;
import org.springframework.stereotype.Component;

/**
 * @author @xsomnus666_xiawenye★
 * @since 2019/4/26 0026 17:33
 * 当你发现自己的才华撑不起野心时，就请安静下来学习吧
 */
@Slf4j
@Component
public class KafkaSendResultHandler implements ProducerListener {

    @Override
    public void onSuccess(ProducerRecord producerRecord, RecordMetadata recordMetadata) {
        log.debug("消息发送成功: " + producerRecord.toString());
    }


    @Override
    public void onError(ProducerRecord producerRecord, Exception exception) {
        log.debug("消息发送失败: " + producerRecord.toString());
    }

}
